//
// Created by deepin on 2020/11/2.
//
#include <iostream>
using namespace std;
void swapr(int & a ,int & b);
void swapp(int * p , int * q);
void swapv(int a, int b);
/*int main ()
{
  int wallet1 = 300;
  int wallet2 = 350;
  cout << "wallet1 =$" << wallet1;
  cout << "wallet =$" << wallet2 << endl;
  cout << "Using references to swap contents:\n";
  swapr(wallet1,wallet2);
  cout << "wallet1 = $" << wallet1;
  cout << "wallet2 = $" << wallet2 << endl;
  cout << "Using pointers to swap contents again:\n";
  swapp(&wallet1,&wallet2);
  cout << "wallet1 =$" << wallet1;
  cout << "wallet =$" << wallet2 << endl;
  cout << "Trying to use passing by value:\n";
  swapv(wallet1,wallet2);
  cout << "wallet1 =$" << wallet1;
  cout << "wallet =$" << wallet2 << endl;
  return 0;
}*/
// 直接修改原始变量
void swapr(int & a ,int & b)
{
  int temp;
  temp = a;
  a=b;
  b=temp;
}
// 直接修改原始变量
void swapp(int * p , int * q)
{
  int temp;
  temp = *p;
  *p = *q;
  *q = temp;
}
// 副本修改
void swapv(int a, int b)
{
  int temp;
  temp = a;
  a = b;
  b = temp;
}